package org.example.friend.controller.question;

import org.example.common.core.controller.BaseController;
import org.example.common.core.domain.Result;
import org.example.common.core.domain.ResultTable;
import org.example.friend.domain.question.dto.QuestionQueryDTO;
import org.example.friend.domain.question.vo.QuestionDetailVO;
import org.example.friend.domain.question.vo.QuestionVO;
import org.example.friend.service.question.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/question")
public class QuestionController extends BaseController {

    @Autowired
    private QuestionService questionService;

    @GetMapping("/semiLogin/list")
    public ResultTable list(QuestionQueryDTO questionQueryDTO) {
        return questionService.list(questionQueryDTO);
    }

    @GetMapping("/semiLogin/hotList")
    public Result<List<QuestionVO>> hotList() {
        return Result.ok(questionService.hotList());
    }

    @GetMapping("/detail")
    public Result<QuestionDetailVO> detail(Long questionId) {
        return Result.ok(questionService.detail(questionId));
    }

    @GetMapping("/preQuestion")
    public Result<String> preQuestion(Long questionId) {
        return Result.ok(questionService.preQuestion(questionId));
    }

    @GetMapping("/nextQuestion")
    public Result<String> nextQuestion(Long questionId) {
        return Result.ok(questionService.nextQuestion(questionId));
    }
}
